home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib / tk / scrollbar.man < prev    next >
Encoding:
Text File  |  1992-08-24  |  11.2 KB  |  367 lines

  1. '\"
  2. '\" Copyright 1990 Regents of the University of California
  3. '\" Permission to use, copy, modify, and distribute this
  4. '\" documentation for any purpose and without fee is hereby
  5. '\" granted, provided that this notice appears in all copies.
  6. '\" The University of California makes no representations about
  7. '\" the suitability of this material for any purpose.  It is
  8. '\" provided "as is" without express or implied warranty.
  9. '\" 
  10. '\" $Header: /user6/ouster/wish/man/RCS/scrollbar.man,v 1.8 92/03/12 16:37:11 ouster Exp $ SPRITE (Berkeley)
  11. '/" 
  12. .\" The definitions below are for supplemental macros used in Sprite
  13. .\" manual entries.
  14. .\"
  15. .\" .HS name section [date [version]]
  16. .\"    Replacement for .TH in other man pages.  See below for valid
  17. .\"    section names.
  18. .\"
  19. .\" .AP type name in/out [indent]
  20. .\"    Start paragraph describing an argument to a library procedure.
  21. .\"    type is type of argument (int, etc.), in/out is either "in", "out",
  22. .\"    or "in/out" to describe whether procedure reads or modifies arg,
  23. .\"    and indent is equivalent to second arg of .IP (shouldn't ever be
  24. .\"    needed;  use .AS below instead)
  25. .\"
  26. .\" .AS [type [name]]
  27. .\"    Give maximum sizes of arguments for setting tab stops.  Type and
  28. .\"    name are examples of largest possible arguments that will be passed
  29. .\"    to .AP later.  If args are omitted, default tab stops are used.
  30. .\"
  31. .\" .BS
  32. .\"    Start box enclosure.  From here until next .BE, everything will be
  33. .\"    enclosed in one large box.
  34. .\"
  35. .\" .BE
  36. .\"    End of box enclosure.
  37. .\"
  38. .\" .VS
  39. .\"    Begin vertical sidebar, for use in marking newly-changed parts
  40. .\"    of man pages.
  41. .\"
  42. .\" .VE
  43. .\"    End of vertical sidebar.
  44. .\"
  45. .\" .DS
  46. .\"    Begin an indented unfilled display.
  47. .\"
  48. .\" .DE
  49. .\"    End of indented unfilled display.
  50. .\"
  51. '\"    # Heading for Sprite man pages
  52. .de HS
  53. .if '\\$2'cmds'       .TH \\$1 1 \\$3 \\$4
  54. .if '\\$2'lib'        .TH \\$1 3 \\$3 \\$4
  55. .if '\\$2'tcl'        .TH \\$1 3 \\$3 \\$4
  56. .if '\\$2'tk'         .TH \\$1 3 \\$3 \\$4
  57. .if t .wh -1.3i ^B
  58. .nr ^l \\n(.l
  59. .ad b
  60. ..
  61. '\"    # Start an argument description
  62. .de AP
  63. .ie !"\\$4"" .TP \\$4
  64. .el \{\
  65. .   ie !"\\$2"" .TP \\n()Cu
  66. .   el          .TP 15
  67. .\}
  68. .ie !"\\$3"" \{\
  69. .ta \\n()Au \\n()Bu
  70. \&\\$1    \\fI\\$2\\fP    (\\$3)
  71. .\".b
  72. .\}
  73. .el \{\
  74. .br
  75. .ie !"\\$2"" \{\
  76. \&\\$1    \\fI\\$2\\fP
  77. .\}
  78. .el \{\
  79. \&\\fI\\$1\\fP
  80. .\}
  81. .\}
  82. ..
  83. '\"    # define tabbing values for .AP
  84. .de AS
  85. .nr )A 10n
  86. .if !"\\$1"" .nr )A \\w'\\$1'u+3n
  87. .nr )B \\n()Au+15n
  88. .\"
  89. .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
  90. .nr )C \\n()Bu+\\w'(in/out)'u+2n
  91. ..
  92. '\"    # BS - start boxed text
  93. '\"    # ^y = starting y location
  94. '\"    # ^b = 1
  95. .de BS
  96. .br
  97. .mk ^y
  98. .nr ^b 1u
  99. .if n .nf
  100. .if n .ti 0
  101. .if n \l'\\n(.lu\(ul'
  102. .if n .fi
  103. ..
  104. '\"    # BE - end boxed text (draw box now)
  105. .de BE
  106. .nf
  107. .ti 0
  108. .mk ^t
  109. .ie n \l'\\n(^lu\(ul'
  110. .el \{\
  111. .\"    Draw four-sided box normally, but don't draw top of
  112. .\"    box if the box started on an earlier page.
  113. .ie !\\n(^b-1 \{\
  114. \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  115. .\}
  116. .el \}\
  117. \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  118. .\}
  119. .\}
  120. .fi
  121. .br
  122. .nr ^b 0
  123. ..
  124. '\"    # VS - start vertical sidebar
  125. '\"    # ^Y = starting y location
  126. '\"    # ^v = 1 (for troff;  for nroff this doesn't matter)
  127. .de VS
  128. .mk ^Y
  129. .ie n 'mc \s12\(br\s0
  130. .el .nr ^v 1u
  131. ..
  132. '\"    # VE - end of vertical sidebar
  133. .de VE
  134. .ie n 'mc
  135. .el \{\
  136. .ev 2
  137. .nf
  138. .ti 0
  139. .mk ^t
  140. \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
  141. .sp -1
  142. .fi
  143. .ev
  144. .\}
  145. .nr ^v 0
  146. ..
  147. '\"    # Special macro to handle page bottom:  finish off current
  148. '\"    # box/sidebar if in box/sidebar mode, then invoked standard
  149. '\"    # page bottom macro.
  150. .de ^B
  151. .ev 2
  152. 'ti 0
  153. 'nf
  154. .mk ^t
  155. .if \\n(^b \{\
  156. .\"    Draw three-sided box if this is the box's first page,
  157. .\"    draw two sides but no top otherwise.
  158. .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  159. .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  160. .\}
  161. .if \\n(^v \{\
  162. .nr ^x \\n(^tu+1v-\\n(^Yu
  163. \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
  164. .\}
  165. .bp
  166. 'fi
  167. .ev
  168. .if \\n(^b \{\
  169. .mk ^y
  170. .nr ^b 2
  171. .\}
  172. .if \\n(^v \{\
  173. .mk ^Y
  174. .\}
  175. ..
  176. '\"    # DS - begin display
  177. .de DS
  178. .RS
  179. .nf
  180. .sp
  181. ..
  182. '\"    # DE - end display
  183. .de DE
  184. .fi
  185. .RE
  186. .sp .5
  187. ..
  188. .HS scrollbar cmds
  189. .BS
  190. '\" Note:  do not modify the .SH NAME line immediately below!
  191. .SH NAME
  192. scrollbar \- Create and manipulate scrollbar widgets
  193. .SH SYNOPSIS
  194. \fBscrollbar\fI pathName \fR?\fIoptions\fR?
  195. .SH "STANDARD OPTIONS"
  196. .LP
  197. .nf
  198. .ta 4c 8c 12c
  199. .VS
  200. \fBactiveForeground\fR    \fBcursor\fR    \fBrelief\fR
  201. .VE
  202. \fBbackground\fR    \fBforeground\fR    \fBrepeatDelay\fR
  203. \fBborderWidth\fR    \fBorient\fR    \fBrepeatInterval\fR
  204. .fi
  205. .LP
  206. See the ``options'' manual entry for details on the standard options.
  207. .SH "WIDGET-SPECIFIC OPTIONS"
  208. .ta 4c
  209. .LP
  210. .nf
  211. Name:    \fBcommand\fR
  212. Class:    \fBCommand\fR
  213. Command-Line Switch:    \fB\-command\fR
  214. .fi
  215. .IP
  216. Specifies the prefix of a Tcl command to invoke to change the view
  217. in the widget associated with the scrollbar.  When a user requests
  218. a view change by manipulating the scrollbar, a Tcl command is
  219. invoked.  The actual command consists of this option followed by
  220. a space and a number.  The number indicates the logical unit that
  221. should appear at the top of the associated window.
  222. .LP
  223. .nf
  224. Name:    \fBwidth\fR
  225. Class:    \fBWidth\fR
  226. Command-Line Switch:    \fB\-width\fR
  227. .fi
  228. .IP
  229. Specifies the desired narrow dimension of the scrollbar window,
  230. not including 3-D border, if any.  For vertical
  231. scrollbars this will be the width and for horizontal scrollbars
  232. this will be the height.
  233. .VS
  234. The value may have any of the forms acceptable to \fBTk_GetPixels\fR.
  235. .VE
  236. .BE
  237.  
  238. .SH DESCRIPTION
  239. .PP
  240. The \fBscrollbar\fR command creates a new window (given by the
  241. \fIpathName\fR argument) and makes it into a scrollbar widget.
  242. Additional
  243. options, described above, may be specified on the command line
  244. or in the option database
  245. to configure aspects of the scrollbar such as its colors, orientation,
  246. and relief.  The \fBscrollbar\fR command returns its
  247. \fIpathName\fR argument.  At the time this command is invoked,
  248. there must not exist a window named \fIpathName\fR, but
  249. \fIpathName\fR's parent must exist.
  250. .PP
  251. A scrollbar is a widget that displays two arrows, one at each end of
  252. the scrollbar, and a \fIslider\fR in the middle portion of the
  253. scrollbar.  A scrollbar is used to provide information about what
  254. is visible in an \fIassociated window\fR that displays an object
  255. of some sort (such as a file being edited or a drawing).
  256. The position and size of the slider indicate which portion of the
  257. object is visible in the associated window.  For example, if the
  258. slider in a vertical scrollbar covers the top third of the area
  259. between the two arrows, it means that the associated window displays
  260. the top third of its object.
  261. .PP
  262. Scrollbars can be used to adjust the view in the associated window
  263. by clicking or dragging with the mouse.  See the BINDINGS section
  264. below for details.
  265.  
  266. .SH "WIDGET COMMAND"
  267. .PP
  268. The \fBscrollbar\fR command creates a new Tcl command whose
  269. name is \fIpathName\fR.  This
  270. command may be used to invoke various
  271. operations on the widget.  It has the following general form:
  272. .DS C
  273. \fIpathName option \fR?\fIarg arg ...\fR?
  274. .DE
  275. \fIOption\fR and the \fIarg\fRs
  276. determine the exact behavior of the command.  The following
  277. commands are possible for scrollbar widgets:
  278. .TP
  279. \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
  280. Query or modify the configuration options of the widget.
  281. If no \fIoption\fR is specified, returns a list describing all of
  282. the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
  283. information on the format of this list).  If \fIoption\fR is specified
  284. with no \fIvalue\fR, then the command returns a list describing the
  285. one named option (this list will be identical to the corresponding
  286. sublist of the value returned if no \fIoption\fR is specified).  If
  287. one or more \fIoption\-value\fR pairs are specified, then the command
  288. modifies the given widget option(s) to have the given value(s);  in
  289. this case the command returns an empty string.
  290. \fIOption\fR may have any of the values accepted by the \fBscrollbar\fR
  291. command.
  292. .TP
  293. \fIpathName \fBget\fR
  294. Returns a Tcl list containing four decimal values, which are
  295. the current \fItotalUnits\fR, \fIwidnowUnits\fR, \fIfirstUnit\fR,
  296. and \fIlastUnit\fR values for the scrollbar.  These are the values
  297. from the most recent \fBset\fR widget command on the scrollbar.
  298. .TP
  299. \fIpathName \fBset\fR \fItotalUnits windowUnits firstUnit lastUnit\fR
  300. This command is invoked to give the scrollbar information about the
  301. widget associated with the scrollbar.  \fITotalUnits\fR is an integer
  302. value giving the total size of the object being displayed in the
  303. associated widget.  The meaning of one unit depends on the associated
  304. widget;  for example, in a text editor widget units might
  305. correspond to lines of
  306. text.  \fIWindowUnits\fR indicates the total number of units that
  307. can fit in the associated window at one time.  \fIFirstUnit\fR
  308. and \fIlastUnit\fR give the indices of the first and last units
  309. currently visible in the associated window (zero corresponds to the
  310. first unit of the object).  This command should
  311. be invoked by the associated widget whenever its object or window
  312. changes size and whenever it changes the view in its window.
  313.  
  314. .SH BINDINGS
  315. .PP
  316. The description below assumes a vertically-oriented scrollbar.
  317. For a horizontally-oriented scrollbar replace the words ``up'', ``down'',
  318. ``top'', and ``bottom'' with ``left'', ``right'', ``left'',
  319. and ``right'', respectively
  320. .PP
  321. A scrollbar widget is divided into five distinct areas.  From top
  322. to bottom, they are:  the top arrow, the top gap (the empty space
  323. between the arrow and the slider), the slider, the bottom gap,
  324. and the bottom arrow.  Pressing mouse button 1 in each area has
  325. a different effect:
  326. .TP 20
  327. \fBtop arrow\fR
  328. Causes the view in the associated window to shift up by one unit
  329. (i.e. the object appears to move down one unit in its window).
  330. If the button is held down the action will auto-repeat.
  331. .TP 20
  332. \fBtop gap\fR
  333. Causes the view in the associated window to shift up by one
  334. less than the number of units in the window
  335. (i.e. the portion of the object that used to appear at the very
  336. top of the window will now appear at the very bottom).
  337. If the button is held down the action will auto-repeat.
  338. .TP 20
  339. \fBslider\fR
  340. Pressing button 1 in this area has no immediate effect except to
  341. cause the slider to appear sunken rather than raised.  However,
  342. if the mouse is moved with the button down then the slider will
  343. be dragged, adjusting the view as the mouse is moved.
  344. .TP 20
  345. \fBbottom gap\fR
  346. Causes the view in the associated window to shift down by one
  347. less than the number of units in the window
  348. (i.e. the portion of the object that used to appear at the very
  349. bottom of the window will now appear at the very top).
  350. If the button is held down the action will auto-repeat.
  351. .TP 20
  352. \fBbottom arrow\fR
  353. Causes the view in the associated window to shift down by one unit
  354. (i.e. the object appears to move up one unit in its window).
  355. If the button is held down the action will auto-repeat.
  356. .PP
  357. Note:  none of the actions described above has an immediate impact
  358. on the position of the slider in the scrollbar.  It simply invokes
  359. the command specified in the \fBcommand\fR option to notify the
  360. associated widget that a change in view is desired.  If the view is
  361. actually changed then the associated widget must invoke the
  362. scrollbar's \fBset\fR widget command to change what is displayed in
  363. the scrollbar.
  364.  
  365. .SH KEYWORDS
  366. scrollbar, widget
  367.